//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Extensibility
{
    public class TreatNullsAsZeroAttribute : ParameterConverterAttribute
    {
        public TreatNullsAsZeroAttribute ()
        {

        }
        public TreatNullsAsZeroAttribute(ReferenceOption refMode)
            : base(refMode)
        {
        }
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(double))
            {
                if (data.Value == null)
                {
                    data.Result = 0d;
                    return;
                }

            }
        }
    }
    public class TreatNullsAsEmptyStringAttribute : ParameterConverterAttribute
    {
        public TreatNullsAsEmptyStringAttribute()
        {

        }
        public TreatNullsAsEmptyStringAttribute(ReferenceOption refMode)
            : base(refMode)
        {
        }
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(string))
            {
                if (data.Value == null)
                {
                    data.Result = string.Empty;
                    return;
                }

            }
        }
    }
}